<template>
  <div class="app-container calendar-list-container">
    <router-link :to="{name:'administrator_list'}">
      <el-button type="primary" v-waves @click="disabled=false">返回</el-button>
    </router-link>
    <div style="margin:20px;">{{ '管理员详情' }}</div>
    <el-form
      style="width:500px"
      :model="agent"
      status-icon
      ref="addForm"
      label-width="150px"
      :disabled="roleLevel != 1"
    >
      <el-form-item label="管理员姓名" prop="agentName">
        <el-input type="text" v-model="agent.agentName"></el-input>
      </el-form-item>
      <el-form-item label="管理员手机号" prop="agentPhone">
        <el-input type="text" v-model="agent.agentPhone"></el-input>
      </el-form-item>
      <el-form-item label="管理员状态" prop="isFlag">
        <el-input v-model="agent.isFlag"></el-input>
      </el-form-item>
      <!-- <el-form-item label="注册时间" prop="ctime">
        <el-input :model="agent.cTime"></el-input>
      </el-form-item>-->
    </el-form>
    <br/><br/>
      <div style="margin:20px;">{{ '订单数统计:' }}</div>
   <br/>
    <el-table  border :data="orderCountData" style="width: 100%">
      <el-table-column prop="dayOrder" label="日订单数" ></el-table-column>
      <el-table-column prop="weekOrder" label="周订单数" ></el-table-column>
      <el-table-column prop="monthOrder" label="月订单数" ></el-table-column>
      <el-table-column prop="quarterOrder" label="季订单数" ></el-table-column>
      <el-table-column prop="yearOrder" label="年订单数" ></el-table-column>
      <el-table-column prop="sumOrder" label="总订单数"></el-table-column>
    </el-table>
    <br/><br/>
    <div style="margin:20px;">{{ '营业额统计（元）:' }}</div>
<br/>
     <el-table  border :data="orderTurnoverData" style="width: 100%">
      <el-table-column prop="dayOrderMoney" label="日营业额" ></el-table-column>
      <el-table-column prop="weekOrderMoney" label="周营业额" ></el-table-column>
      <el-table-column prop="monthOrderMoney" label="月营业额" ></el-table-column>
      <el-table-column prop="quarterOrderMoney" label="季营业额" ></el-table-column>
      <el-table-column prop="yearOrderMoney" label="年营业额" ></el-table-column>
      <el-table-column prop="sumOrderMoney" label="总营业额"></el-table-column>
    </el-table>
  </div>
</template>
<script>
import { agentInfo } from "@/api/administrator";
import { getAddressByAreaId, getId, getAddress } from "@/utils/getAddress";
import { parseTime } from "@/utils";
import pcq from "@/components/index";
import {
  getWagentList,
  getChargeRulesList,
  addChargeRules,
  updChargeRules,
  delChargeRules,
  updHospital
} from "@/api/administrator";
export default {
  name: "administrator_detail",
  components: {
    pcq
  },
  data() {
    return {
      dialog: {
        add: false
      },
      loading: {
        add: false
      },
      roleLevel: "",
      addRules: {},
      provices: [],
      cities: [],
      areas: [],
      pId: "",
      cId: "",
      WagentList: [],
      chargeRules: [],
      agent: {
        agentId: "",
        agentPhone: "",
        isFlag: "",
        cTime: "",
        agentName:""
      },
      orderTurnoverData: [],
      orderCountData: [],

      addChargeRules: {
        dayNumber: [{ required: true, message: "请输入天数", trigger: "blur" }],
        rulePrice: [{ required: true, message: "请输入金额", trigger: "blur" }]
      },
      dialogType: 1,
      hospitalId: this.$route.query.hospitalId,
      total: 0,
      listQuery: {
        pageNo: 1,
        pageSize: 10,
        hospitalId: this.$route.query.hospitalId
      },
      ruleId: "",
      addresss: "",
      phoneAgentFalse: ""
    };
  },
  created() {
    this.getData();
    // console.log("this.$route.query.cTime=====",parseTime(this.$route.query.cTime))
    // this.agent.cTime = parseTime(this.$route.query.cTime);
  },
  computed: {},
  methods: {
    getData() {
      this.agent.agentId = this.$route.query.agentId;
      this.agent.agentName = this.$route.query.agentName;
      this.agent.agentPhone = this.$route.query.agentPhone;
      this.agent.isFlag = this.$route.query.isFlag == 1 ? "启用" : "禁用";
      this.agent.cTime = parseTime(this.$route.query.cTime);
      this.agentInfo(this.agent.agentId);
    },
    //获取医院详情中的套餐列表
    async agentInfo(agentId) {
      const { data } = await agentInfo({
        agentId: agentId
      });

      this.orderCountData.push(data.orderCountData);
      // console.log(this.orderCountData, "=======================");

      this.orderTurnoverData.push(data.orderTurnoverData);

      // this.orderCountData[0].dayOrder = data.orderCountData.dayOrder;
      // this.orderCountData[0].monthOrder = data.orderCountData.monthOrder;
      // this.orderCountData[0].quarterOrder = data.orderCountData.quarterOrder;
      // this.orderCountData[0].sumOrder = data.orderCountData.sumOrder;
      // this.orderCountData[0].weekOrder = data.orderCountData.weekOrder;
      // this.orderCountData[0].yearOrder = data.orderCountData.yearOrder;

      // this.orderTurnoverData[0].dayOrderMoney = data.orderTurnoverData.dayOrderMoney;
      //       this.orderTurnoverData[0].monthOrderMoney = data.orderTurnoverData.monthOrderMoney;
      // this.orderTurnoverData[0].quarterOrderMoney = data.orderTurnoverData.quarterOrderMoney;
      // this.orderTurnoverData[0].sumOrderMoney = data.orderTurnoverData.sumOrderMoney;
      // this.orderTurnoverData[0].weekOrderMoney = data.orderTurnoverData.weekOrderMoney;
      // this.orderTurnoverData[0].yearOrderMoney = data.orderTurnoverData.yearOrderMoney;
    },

    handleSizeChange(val) {
      this.listQuery.pageSize = val;
      this.getChargeRulesList();
    },
    handleCurrentChange(val) {
      this.listQuery.pageNo = val;
      this.getChargeRulesList();
    }
  }
};
</script>
